#cmake_minimum_required( VERSION 3.10 )
#
#project( gyro_flow_port )
#
#set(CMAKE_BUILD_TYPE "Debug")
#set(CMAKE_CXX_FLAGS "-std=c++11 -O3 -pthread")
## set(CMAKE_CXX_STANDARD 17)
#
#set(OpenCV_DIR "D:\\projects\\opencv46\\opencv\\mingw-build\\install")
#
# find_package(OpenCV 4 REQUIRED)
##find_package(OpenCV 3 REQUIRED)
#include_directories(${OpenCV_INCLUDE_DIRS})
#
#
#include_directories(
#        .
#        imu_smooth
#        imu_track
#        rolling_shutter_correct
#        utils
#)
#
#aux_source_directory (imu_smooth                IMU_SMOOTH_SRC_LIST)
#aux_source_directory (imu_track                 IMU_TRACK_SRC_LIST)
#aux_source_directory (rolling_shutter_correct   ROLLING_SHUTTER_CORRECT_SRC_LIST)
#aux_source_directory (utils                     UTILS_SRC_LIST)
#
#add_executable (
#        ${PROJECT_NAME}
#        main.cpp
#        ${IMU_SMOOTH_SRC_LIST}
#        ${IMU_TRACK_SRC_LIST}
#        ${ROLLING_SHUTTER_CORRECT_SRC_LIST}
#        ${UTILS_SRC_LIST}
#)
#
#target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})

cmake_minimum_required(VERSION 3.10)

project(gyro_flow_port)

# 设置编译类型为 Debug 或 Release
set(CMAKE_BUILD_TYPE "Debug")

# 编译器选项，适配 RK3399（ARM 架构），启用多线程和 NEON 优化
#set(CMAKE_CXX_FLAGS "-std=c++11 -O3 -pthread -mfpu=neon")
set(CMAKE_CXX_FLAGS "-std=c++11 -O3 -pthread")
# 自动查找 OpenCV（使用 RK3399 上的本地环境）
find_package(OpenCV 4 REQUIRED)
# 如果是 OpenCV 3，则改为：find_package(OpenCV 3 REQUIRED)

# 包含 OpenCV 的头文件路径
include_directories(${OpenCV_INCLUDE_DIRS})

# 包含源码的子目录
include_directories(
    .
    imu_smooth
    imu_track
    rolling_shutter_correct
    utils
)

# 自动获取子目录中的源文件
aux_source_directory(imu_smooth IMU_SMOOTH_SRC_LIST)
aux_source_directory(imu_track IMU_TRACK_SRC_LIST)
aux_source_directory(rolling_shutter_correct ROLLING_SHUTTER_CORRECT_SRC_LIST)
aux_source_directory(utils UTILS_SRC_LIST)

# 定义可执行文件
add_executable(
    ${PROJECT_NAME}
    main.cpp
    ${IMU_SMOOTH_SRC_LIST}
    ${IMU_TRACK_SRC_LIST}
    ${ROLLING_SHUTTER_CORRECT_SRC_LIST}
    ${UTILS_SRC_LIST}
)

# 链接 OpenCV 库
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
